<?php
header("content-type:text/html;charset=utf-8");
$username = isset($_POST['username'])?$_POST['username']:"";
$pwd = isset($_POST['pwd'])?$_POST['pwd']:"";
$z_name= isset($_POST['z_name'])?$_POST['z_name']:"";
$money = isset($_POST['money'])?$_POST['money']:"";
//var_dump($money);die;
$dsn = "mysql:host=127.0.0.1;dbname=07c;charset=utf8";
$pdo = new PDO($dsn,'root','root');
$sql = "insert into user(username,pwd,z_name,money) values('$username','$pwd','$z_name','$money')";
//var_dump($sql);die;
$res = $pdo->exec($sql);
if($res){
echo "<script>alert('添加成功');location.href='daochu.php'</script>";
}else{
echo "<script>alert('添加失败');location.href='insert.html'</script>";
}

?>